<?php
      require_once("../view/menu.php");
?>
<div id="content">
<div class="title">Specjalizacja dla kierunku: </div>
    <form action="<?php if(!empty($base_path)){echo $base_path."specialization_edit?direction=$direction_id&spec=".$spec_id;
                         }else{ echo "../specialization_edit?direction=$direction_id&spec=".$spec_id;}?>"method="POST">
        <input name="spec_name" type="input" style="width: 700px;" value="<?php echo $specialization['nazwa']; ?>" /> <br />
        <div>
            <br /><br /><b><i>Lista przedmiotów:</i></b>
            <input type="submit" name="save" value="Zapisz zmiany" style="text-align: center; width: 160px"/> 
            <input type="submit" name="back" value="Powrót"/> <br/>
        </div>


    <?php foreach($all_subject as $subject):?>
        <input type="checkbox" name="<?php echo $subject['id']?>" value="<?php echo $subject['id']?>"
        <?php if($subject['checked']) echo 'checked="checked"';?>/>
        <?php echo $subject['nazwa']?>
        <!--  zaznaczony przedmiot   -->
        <?php if($subject['checked']):?>
<!--        <form action="<?php if(!empty($base_path)){echo $base_path."specialization_edit?direction=$direction_id&spec=".$spec_id;
                         }else{ echo "../specialization_edit?direction=$direction_id&spec=".$spec_id;}?>"method="POST">-->
        <select name="<?php echo $subject['id'] ?>" onchange="submit()">
            <?php foreach($subject_category as $category){
                    echo '<option value='.$category;
                    if($category == $subject['kategoria'])
                        echo ' selected="selected"';
                    echo '>'. $category .'</option>';} ?>
        </select>
         <input type="hidden" name="update_category" value=<?php echo $subject['id'];?> />
       
<!--       </form>-->
        <?php endif; ?>
        <!--   -->
          <br />
    <?php endforeach; ?>
    </form>
</div>
<?php
      require_once("../view/footer.php");
?>